package com.ctbri.vSearch.util;

import java.util.ArrayList;
import java.util.Date;

public class TimeUtil {
	private  Date start =null;
	private  ArrayList<Long> pausePoint = new ArrayList<>();
	private  Date end =null;
	
	/**
	 * 得到开始时间
	 * @return long 当前的时间
	 */
	public  long startTime(){
		start = new Date();
		return start.getTime();
	}
	/**
	 * 得到当前时间作为结束时间
	 * @return
	 */
	public  long stopTime(){
		end = new Date();
		return end.getTime();		
	}
	public  void setPausePoint(){
		pausePoint.add(new Date().getTime());
	}
	public  ArrayList<Long> getPausePoint(){
		return pausePoint;
	}
	
	/**
	 * 得到当前时间点到上一次调用startTime()方法经历的毫秒数
	 * @return
	 */
	public  long getperiod(){
		if(start == null){
			return 0;
		}
		return new Date().getTime()-start.getTime();
	}
	 
}
